from sqlalchemy import Column, Integer, String, BigInteger

from .database import Base


class User(Base):
    __tablename__ = "users"

    id = Column(Integer, primary_key=True, index=True)
    username = Column(String, unique=True, index=True, nullable=False)
    api_key = Column(String, unique=True, index=True, nullable=False)
    # 以分为单位存储token，避免浮点数精度问题
    token_balance = Column(BigInteger, nullable=False, default=0)
